home *** CD-ROM | disk | FTP | other *** search
- Subject: Re: Scripting Problem
- Sent: 8/6/96 11:03 AM
- Received: 8/6/96 10:21 AM
- From: Greg Friedman, friedman@cognosis.com
- Reply-To: ODF Interest, ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
-
- Serge Froment wrote:
- > >The only property ODF requires all
- > >scriptable objects to support is pClass. Some classes of objects can be
- > >specified by numeric index, others can't.
- >
- > The script command "get someProperty of first someClass" has ODF to access
- > an object by index. When access index is not supported, we get an error
- > message like "Can't make someClass 1 into someClass 1". This message
- > confused my into thinking there were an ODF bug. I guess many users will be
- > confused too.
-
- I took a look at the case you described, and tried a couple of scenarios.
- Right now, I don't currently call HasProperty when doing object resolution
- by index (including the absolute ordinal values). I'll add some calls to
- HasProperty when accessing object by the various indexicals. I'm not sure
- how you are getting the specific message you are getting - I suspect it has
- something to do with the way you are generating scriptable objects on they
- fly from within your iterator. Even though I can't reproduce your error,
- there is a good chance that preventing the indexical accessors from working
- when explicit support for pIndex isn't present will give users a more
- sensible error message. Much of this is moot anyhow, because pIndex should
- be supported in almost all cases.
-
- > I have another question I posted to the list and get some reply from Chris
- > Hunt, but I am still confused. Here is my question:
- >
- > Since scriptable parts inherit from FW_MPartScriptable (or
- > FW_MEmbeddingPartScriptable), it looks like parts can have properties.
- > However, I can't figure out how to specify part properties inside the
- > 'aete' resource in such way that ODF will call my override of GetProperty
- > for the my added property of my part object.
-
- All 'aete' resource should contain at least a stub of the 'ODst' suite
- defined by OpenDoc. Since you want to extend the part class introduced in
- ODst, you should define an 'ODst' suite that includes _only_ the part class
- with your extra properties. Do not redefine the existing properties, just
- define the properties you are adding. This is documented in "Inside
- Macintosh: Interapplication Communication" in the section "Extending the
- Standard Suites". One caveat applies: the current version of OpenDoc
- collapses all part aete resources into a single namespace. This means that
- the properties you define will appear to be properties of the "part" class,
- and AppleScript will allow users to compile scripts referencing your
- properties against any part editor.
-
- Accessing objects or properties of "part" is a special case. OpenDoc
- provides a bunch of default accessors that do the right thing for all of
- the properties and elements intrisic to the defined part class. When ODF
- gets a request for an object contained in "part", it calls the
- GetObjectContainedInPart method of FW_MPartScriptable. This is necessary,
- to distinguish between object contained by the "null" object, and objects
- contained by "part". By default, ODF defers accesses to objects contained
- by "part" to the OpenDoc shell. We always handle accesses to objects
- contained by the "null" object. In your case, you probably need to handle
- the request for a property of part.
-
- I just added some code to FW_MPartScriptable::GetObjectContainedInPart that
- I think may address your problem. This method now reads as follows:
-
- FW_MScriptable* MPartScriptable::GetObjectContainedInPart(
- Environment* ev,
- ODDescType desiredClass,
- ODDescType form,
- FW_CDesc& selectionData)
- {
- FW_MScriptable* acquiredObject = NULL;
-
- if (desiredClass == cProperty)
- {
- FW_CPart* part = FW_DYNAMIC_CAST(FW_CPart, this);
- FW_ASSERT(part);
- acquiredObject = GetContainedObject(ev,
- part, desiredClass, form,
- selectionData);
- }
- return acquiredObject;
- }
-
- This new code special cases property accesses, and will ultimately cause a
- call to HasProperty to be made, and a property designator will be created
- if the property is supported.
-
- Please try this, and let me know if it fixes your problem.
-
- Greg.
-
-
- ___________________________________________________________
- Greg Friedman ODF Engineering Apple Computer
-
-
-